package com.ht.medicaltreatment.adapter

import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ht.medicaltreatment.R
import com.ht.medicaltreatment.bean.HaoCaiProgressBean

class ProgressAdapter : BaseQuickAdapter<HaoCaiProgressBean.DataBean.ProjectConsumableListBean,BaseViewHolder>(R.layout.progress_c_layout){
    override fun convert(holder: BaseViewHolder, item: HaoCaiProgressBean.DataBean.ProjectConsumableListBean) {
        holder.setText(R.id.tvName,item.name)
        if(item.id == -1 || item.id == -2){
            //不做处理
            //LogUtils.i(item.id,item.name,"总："+item.number,"容量："+item.specification)
        }else{
            holder.setText(R.id.tvSpecifications,item.specification)
            holder.setText(R.id.tvNumber,"${item.number}")
        }

        val recyclerView = holder.getView<RecyclerView>(R.id.recyclerView)
        recyclerView.layoutManager = LinearLayoutManager(context)
        val adapter = BottomAdapter()
        recyclerView.adapter = adapter
        adapter.setNewInstance(item.bottomBeanList)
    }
}
